package Logicamente;
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import java.awt.Font;
import java.awt.Dimension;

import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;

import java.awt.Toolkit;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaDatosPartida extends javax.swing.JFrame {
	private JPanel panel_superior;
	private JPanel panel_inferior;
	private JLabel label;
	private JLabel label_1;
	private JLabel label_2;
	private JLabel label_3;
	private JLabel label_4;
	private JLabel label_5;
	private JLabel label_6;
	private JLabel label_7;
	private JLabel label_8;
	private JLabel label_9;
	private JLabel label_10;
	private JLabel label_11;
	private JLabel label_12;
	private JLabel label_13;
	private JLabel label_14;
	private JLabel label_15;
	private JLabel label_16;
	private JLabel label_17;
	private JButton button;
	private JLabel label_18;
	private JLabel label_19;
	private JLabel label_20;
	private JLabel label_21;
	private JPanelConFondo contentPane;

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}


	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaDatosPartida inst = new VentanaDatosPartida(0,0,null,null);
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VentanaDatosPartida(int tiempoT,int respCorrectas,Usuario u,Partida p) {
		super();
		setTitle("Logicamente");
		setIconImage(Toolkit.getDefaultToolkit().getImage(VentanaDatosPartida.class.getResource("/Imagenes/L.png")));
		BorderLayout borderLayout = (BorderLayout) getContentPane().getLayout();
		contentPane = new JPanelConFondo("/Imagenes/fondo.jpg");
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		initGUI(tiempoT,respCorrectas,u,p);
	}
	
	private void initGUI(final int tiempoT, final int respCorrectas, final Usuario u, final Partida p) {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panel_superior = new JPanelConFondo("/Imagenes/fondo_t.png");
				panel_superior.setBorder(null);
				getContentPane().add(panel_superior, BorderLayout.NORTH);
				GridBagLayout gbl_panel_superior = new GridBagLayout();
				gbl_panel_superior.columnWidths = new int[] {20, 200, 100, 20};
				gbl_panel_superior.rowHeights = new int[]{20, 0, 20, 0, 0, 0, 0, 0, 0};
				gbl_panel_superior.columnWeights = new double[]{100.0, 50.0, 50.0, 100.0};
				gbl_panel_superior.rowWeights = new double[]{100.0, 0.0, 100.0, 50.0, 50.0, 50.0, 50.0, 50.0, Double.MIN_VALUE};
				panel_superior.setLayout(gbl_panel_superior);
				{
					label = new JLabel();
					label.setText("Datos del usuario");
					label.setFont(new Font("SansSerif", Font.BOLD | Font.ITALIC, 18));
					GridBagConstraints gbc_label = new GridBagConstraints();
					gbc_label.gridwidth = 2;
					gbc_label.insets = new Insets(0, 0, 5, 5);
					gbc_label.gridx = 1;
					gbc_label.gridy = 1;
					panel_superior.add(label, gbc_label);
				}
				{
					label_1 = new JLabel();
					label_1.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_1.setText("Usuario");
					GridBagConstraints gbc_label_1 = new GridBagConstraints();
					gbc_label_1.anchor = GridBagConstraints.WEST;
					gbc_label_1.insets = new Insets(0, 0, 5, 5);
					gbc_label_1.gridx = 1;
					gbc_label_1.gridy = 3;
					panel_superior.add(label_1, gbc_label_1);
				}
				{
					label_2 = new JLabel();
					label_2.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_2.setText(u.getNick());
					GridBagConstraints gbc_label_2 = new GridBagConstraints();
					gbc_label_2.insets = new Insets(0, 0, 5, 5);
					gbc_label_2.gridx = 2;
					gbc_label_2.gridy = 3;
					panel_superior.add(label_2, gbc_label_2);
				}
				{
					label_3 = new JLabel();
					label_3.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_3.setText("Nombre");
					GridBagConstraints gbc_label_3 = new GridBagConstraints();
					gbc_label_3.anchor = GridBagConstraints.WEST;
					gbc_label_3.insets = new Insets(0, 0, 5, 5);
					gbc_label_3.gridx = 1;
					gbc_label_3.gridy = 4;
					panel_superior.add(label_3, gbc_label_3);
				}
				{
					label_4 = new JLabel();
					label_4.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_4.setText(u.getNombre());
					GridBagConstraints gbc_label_4 = new GridBagConstraints();
					gbc_label_4.insets = new Insets(0, 0, 5, 5);
					gbc_label_4.gridx = 2;
					gbc_label_4.gridy = 4;
					panel_superior.add(label_4, gbc_label_4);
				}
				{
					label_5 = new JLabel();
					label_5.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_5.setText("Correo");
					GridBagConstraints gbc_label_5 = new GridBagConstraints();
					gbc_label_5.anchor = GridBagConstraints.WEST;
					gbc_label_5.insets = new Insets(0, 0, 5, 5);
					gbc_label_5.gridx = 1;
					gbc_label_5.gridy = 5;
					panel_superior.add(label_5, gbc_label_5);
				}
				{
					label_6 = new JLabel();
					label_6.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_6.setText(u.getMail());
					GridBagConstraints gbc_label_6 = new GridBagConstraints();
					gbc_label_6.insets = new Insets(0, 0, 5, 5);
					gbc_label_6.gridx = 2;
					gbc_label_6.gridy = 5;
					panel_superior.add(label_6, gbc_label_6);
				}
				{
					label_7 = new JLabel();
					label_7.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_7.setText("Grado");
					GridBagConstraints gbc_label_7 = new GridBagConstraints();
					gbc_label_7.anchor = GridBagConstraints.WEST;
					gbc_label_7.insets = new Insets(0, 0, 5, 5);
					gbc_label_7.gridx = 1;
					gbc_label_7.gridy = 6;
					panel_superior.add(label_7, gbc_label_7);
				}
				{
					label_9 = new JLabel();
					label_9.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_9.setText(u.getAnio());
					GridBagConstraints gbc_label_9 = new GridBagConstraints();
					gbc_label_9.insets = new Insets(0, 0, 5, 5);
					gbc_label_9.gridx = 2;
					gbc_label_9.gridy = 6;
					panel_superior.add(label_9, gbc_label_9);
				}
				{
					label_8 = new JLabel();
					label_8.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_8.setText("Curso");
					GridBagConstraints gbc_label_8 = new GridBagConstraints();
					gbc_label_8.anchor = GridBagConstraints.WEST;
					gbc_label_8.insets = new Insets(0, 0, 0, 5);
					gbc_label_8.gridx = 1;
					gbc_label_8.gridy = 7;
					panel_superior.add(label_8, gbc_label_8);
				}
				{
					label_10 = new JLabel();
					label_10.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_10.setText(u.getCurso());
					GridBagConstraints gbc_label_10 = new GridBagConstraints();
					gbc_label_10.insets = new Insets(0, 0, 0, 5);
					gbc_label_10.gridx = 2;
					gbc_label_10.gridy = 7;
					panel_superior.add(label_10, gbc_label_10);
				}
			}
			{
				panel_inferior = new JPanelConFondo("/Imagenes/fondo_t.png");
				panel_inferior.setBorder(null);
				getContentPane().add(panel_inferior, BorderLayout.SOUTH);
				GridBagLayout gbl_panel_inferior = new GridBagLayout();
				gbl_panel_inferior.columnWidths = new int[] {20, 200, 100, 20};
				gbl_panel_inferior.rowHeights = new int[] {0, 20, 0, 0, 0, 0, 0, 20, 0, 20};
				gbl_panel_inferior.columnWeights = new double[]{100.0, 50.0, 50.0, 100.0};
				gbl_panel_inferior.rowWeights = new double[]{0.0, 100.0, 50.0, 50.0, 50.0, 50.0, 50.0, 100.0, 0.0, 100.0};
				panel_inferior.setLayout(gbl_panel_inferior);
				{
					label_11 = new JLabel();
					label_11.setText("Datos de la partida");
					label_11.setFont(new Font("SansSerif", Font.BOLD | Font.ITALIC, 18));
					GridBagConstraints gbc_label_11 = new GridBagConstraints();
					gbc_label_11.gridwidth = 2;
					gbc_label_11.insets = new Insets(0, 0, 5, 5);
					gbc_label_11.gridx = 1;
					gbc_label_11.gridy = 0;
					panel_inferior.add(label_11, gbc_label_11);
				}
				{
					label_12 = new JLabel();
					label_12.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_12.setText("Nombre de la partida");
					GridBagConstraints gbc_label_12 = new GridBagConstraints();
					gbc_label_12.anchor = GridBagConstraints.WEST;
					gbc_label_12.insets = new Insets(0, 0, 5, 5);
					gbc_label_12.gridx = 1;
					gbc_label_12.gridy = 2;
					panel_inferior.add(label_12, gbc_label_12);
				}
				{
					label_15 = new JLabel();
					label_15.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_15.setText(p.getNombre());
					GridBagConstraints gbc_label_15 = new GridBagConstraints();
					gbc_label_15.insets = new Insets(0, 0, 5, 5);
					gbc_label_15.gridx = 2;
					gbc_label_15.gridy = 2;
					panel_inferior.add(label_15, gbc_label_15);
				}
				{
					label_13 = new JLabel();
					label_13.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_13.setText("Dificultad");
					GridBagConstraints gbc_label_13 = new GridBagConstraints();
					gbc_label_13.anchor = GridBagConstraints.WEST;
					gbc_label_13.insets = new Insets(0, 0, 5, 5);
					gbc_label_13.gridx = 1;
					gbc_label_13.gridy = 3;
					panel_inferior.add(label_13, gbc_label_13);
				}
				{
					label_16 = new JLabel();
					label_16.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_16.setText(p.getDificultad());
					GridBagConstraints gbc_label_16 = new GridBagConstraints();
					gbc_label_16.insets = new Insets(0, 0, 5, 5);
					gbc_label_16.gridx = 2;
					gbc_label_16.gridy = 3;
					panel_inferior.add(label_16, gbc_label_16);
				}
				{
					label_14 = new JLabel();
					label_14.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_14.setText("Cantidad de participantes");
					GridBagConstraints gbc_label_14 = new GridBagConstraints();
					gbc_label_14.anchor = GridBagConstraints.WEST;
					gbc_label_14.insets = new Insets(0, 0, 5, 5);
					gbc_label_14.gridx = 1;
					gbc_label_14.gridy = 4;
					panel_inferior.add(label_14, gbc_label_14);
				}
				{
					label_17 = new JLabel();
					label_17.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_17.setText(p.getCantParticipantes());
					GridBagConstraints gbc_label_17 = new GridBagConstraints();
					gbc_label_17.insets = new Insets(0, 0, 5, 5);
					gbc_label_17.gridx = 2;
					gbc_label_17.gridy = 4;
					panel_inferior.add(label_17, gbc_label_17);
				}
				{
					label_18 = new JLabel();
					label_18.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_18.setText("Puntaje obtenido");
					GridBagConstraints gbc_label_18 = new GridBagConstraints();
					gbc_label_18.anchor = GridBagConstraints.WEST;
					gbc_label_18.insets = new Insets(0, 0, 5, 5);
					gbc_label_18.gridx = 1;
					gbc_label_18.gridy = 5;
					panel_inferior.add(label_18, gbc_label_18);
				}
				{
					label_20 = new JLabel();
					label_20.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_20.setText(""+tiempoT*respCorrectas);
					GridBagConstraints gbc_label_20 = new GridBagConstraints();
					gbc_label_20.insets = new Insets(0, 0, 5, 5);
					gbc_label_20.gridx = 2;
					gbc_label_20.gridy = 5;
					panel_inferior.add(label_20, gbc_label_20);
				}
				{
					label_19 = new JLabel();
					label_19.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_19.setText("Respuestas correctas");
					GridBagConstraints gbc_label_19 = new GridBagConstraints();
					gbc_label_19.anchor = GridBagConstraints.WEST;
					gbc_label_19.insets = new Insets(0, 0, 5, 5);
					gbc_label_19.gridx = 1;
					gbc_label_19.gridy = 6;
					panel_inferior.add(label_19, gbc_label_19);
				}
				{
					label_21 = new JLabel("");
					label_21.setFont(new Font("DejaVu Sans", Font.BOLD, 12));
					label_21.setText(""+respCorrectas);
					GridBagConstraints gbc_label_21 = new GridBagConstraints();
					gbc_label_21.insets = new Insets(0, 0, 5, 5);
					gbc_label_21.gridx = 2;
					gbc_label_21.gridy = 6;
					panel_inferior.add(label_21, gbc_label_21);
				}
				{
					button = new JButton();
					button.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent arg0) {
							actionVolver(tiempoT, respCorrectas, u, p);
						}
					});
					button.setIcon(new ImageIcon(VentanaDatosPartida.class.getResource("/Imagenes/boton_volver_f.png")));
					GridBagConstraints gbc_button = new GridBagConstraints();
					gbc_button.gridwidth = 2;
					gbc_button.insets = new Insets(0, 0, 5, 5);
					gbc_button.gridx = 1;
					gbc_button.gridy = 8;
					panel_inferior.add(button, gbc_button);
				}
			}
			pack();
			this.setSize(500,500);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	protected void actionVolver(int tiempoT, int respCorrectas,Usuario u,Partida p) {
		VentanaFinDeJuego v = new VentanaFinDeJuego(tiempoT,respCorrectas,u,p);
		v.setLocationRelativeTo(null);
		v.setVisible(true);			
		this.setVisible(false);
		this.hide();
	}
}
